<html>
<head>
<title>Docs For Class DbConnector</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">DbConnector</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
        
                                                        
                                                  		  [ <a href="../classtrees_DbConnector.html" class="menu">class tree: DbConnector</a> ]
		  [ <a href="../elementindex_DbConnector.html" class="menu">index: DbConnector</a> ]
		  	    [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
      <b>Packages:</b><br />
              <a href="../li_default.html">default</a><br />
              <a href="../li_DbConnector.html">DbConnector</a><br />
              <a href="../li_Main.html">Main</a><br />
            <br /><br />
                        <b>Files:</b><br />
      	  <div class="package">
			<a href="../DbConnector/_lib---user.lib.php.html">		user.lib.php
		</a><br>
	  </div><br />
      
      
            <b>Classes:</b><br />
        <div class="package">
		    		<a href="../DbConnector/DbConnector.html">DbConnector</a><br />
	  </div>
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1>Class: DbConnector</h1>
Source Location: /lib/user.lib.php<br /><br />


<table width="100%" border="0">
<tr><td valign="top">

<h3><a href="#class_details">Class Overview</a></h3>
<pre></pre><br />
<div class="description">This class handles all connections to the database.</div><br /><br />
<h4>Author(s):</h4>
<ul>
          <li>Keith Iu</li>
            </ul>




        
    
<h4>Version:</h4>
<ul>
  <li>0.1</li>
</ul>

        
</td>



<td valign="top">
<h3><a href="#class_methods">Methods</a></h3>
<ul>
    <li><a href="../DbConnector/DbConnector.html#method__construct">__construct</a></li>
    <li><a href="../DbConnector/DbConnector.html#method__destruct">__destruct</a></li>
    <li><a href="../DbConnector/DbConnector.html#methodcloseConnection">closeConnection</a></li>
    <li><a href="../DbConnector/DbConnector.html#methodexecQuery">execQuery</a></li>
    <li><a href="../DbConnector/DbConnector.html#methodmakeConnection">makeConnection</a></li>
    <li><a href="../DbConnector/DbConnector.html#methodmakeSql">makeSql</a></li>
    <li><a href="../DbConnector/DbConnector.html#methodprintQueryResultTable">printQueryResultTable</a></li>
  </ul>
</td>

</tr></table>
<hr />

<table width="100%" border="0"><tr>






</tr></table>
<hr />

<a name="class_details"></a>
<h3>Class Details</h3>
<div class="tags">
[line 32]<br />
This class handles all connections to the database.<br /><br /><p>All operations on the database should be performed through this class. <br /><br /></p><p>Example Usage:  <ol><li><div class="src-line">&nbsp;<span class="src-var">$db&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../DbConnector/DbConnector.html">DbConnector</a></span>\<span class="src-id"><a href="../DbConnector/DbConnector.html">DbConnector</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../DbConnector/DbConnector.html#methodmakeConnection">makeConnection</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$sql&nbsp;</span>=&nbsp;<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../DbConnector/DbConnector.html#methodmakeSql">makeSql</a><span class="src-sym">(</span><span class="src-str">&quot;test&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;*&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$result&nbsp;</span>=&nbsp;<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../DbConnector/DbConnector.html#methodexecQuery">execQuery</a><span class="src-sym">(</span><span class="src-var">$sql</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../DbConnector/DbConnector.html#methodprintQueryResultTable">printQueryResultTable</a><span class="src-sym">(</span><span class="src-var">$result</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$db</span><span class="src-sym">-&gt;</span><a href="../DbConnector/DbConnector.html#methodcloseConnection">closeConnection</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;unset<span class="src-sym">(</span><span class="src-var">$db</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
</ol></p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>author:</b>&nbsp;&nbsp;</td><td>Keith Iu</td>
  </tr>
  <tr>
    <td><b>version:</b>&nbsp;&nbsp;</td><td>0.1</td>
  </tr>
</table>
</div>
</div><br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br />


<hr />
<a name="class_methods"></a>
<h3>Class Methods</h3>
<div class="tags">

  <hr />
	<a name="method__construct"></a>
	<h3>constructor __construct <span class="smalllinenumber">[line 93]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>DbConnector __construct(
)</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Set default value for class properties.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>todo:</b>&nbsp;&nbsp;</td><td>Load default value from some config file.</td>
  </tr>
</table>
</div>
<br /><br />

	
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
  <hr />
	<a name="method__destruct"></a>
	<h3>destructor __destruct <span class="smalllinenumber">[line 110]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>void __destruct(
)</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Close datebase connection if still opened.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../DbConnector/DbConnector.html#methodcloseConnection">DbConnector::closeConnection()</a></td>
  </tr>
</table>
</div>
<br /><br />

	
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
  <hr />
	<a name="methodcloseConnection"></a>
	<h3>method closeConnection <span class="smalllinenumber">[line 155]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool closeConnection(
)</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Close datebase connection.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td>Return TRUE if successful, FALSE if failed.</td>
  </tr>
  <tr>
    <td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
  </tr>
</table>
</div>
<br /><br />

	
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
  <hr />
	<a name="methodexecQuery"></a>
	<h3>method execQuery <span class="smalllinenumber">[line 173]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>MySQLi_Result|bool execQuery(
string
$query)</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Execute a query.<br /><br /><p>This method simply call <a href="http://www.php.net/manual/en/mysqli.query.php">mysqli::query()</a> and return its return value.</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td>Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries this method will return a result object. For other successful queries this method will return TRUE.</td>
  </tr>
  <tr>
    <td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
  </tr>
</table>
</div>
<br /><br />

	
        <h4>Parameters:</h4>
    <div class="tags">
    <table border="0" cellspacing="0" cellpadding="0">
          <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$query</b>&nbsp;&nbsp;</td>
        <td>Query String.</td>
      </tr>
        </table>
    </div><br />
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
  <hr />
	<a name="methodmakeConnection"></a>
	<h3>method makeConnection <span class="smalllinenumber">[line 123]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>bool makeConnection(
)</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Establish connection to database server.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td>Return TRUE if successful, FALSE if failed.</td>
  </tr>
  <tr>
    <td><b>todo:</b>&nbsp;&nbsp;</td><td>Handle error output.</td>
  </tr>
  <tr>
    <td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
  </tr>
</table>
</div>
<br /><br />

	
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
  <hr />
	<a name="methodmakeSql"></a>
	<h3>method makeSql <span class="smalllinenumber">[line 196]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>string makeSql(
string
$table, [string|field
$field = &quot;*&quot;], [string
$where = NULL], [string
$order = NULL], [int
$offset = NULL], [int
$rowCount = NULL])</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Build a simple SQL SELECT query.<br /><br /><p>This method builds a simple SQL SELECT query on a single table.<br /><br /></p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>return:</b>&nbsp;&nbsp;</td><td>SQL query string.</td>
  </tr>
  <tr>
    <td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
  </tr>
</table>
</div>
<br /><br />

	
        <h4>Parameters:</h4>
    <div class="tags">
    <table border="0" cellspacing="0" cellpadding="0">
          <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$table</b>&nbsp;&nbsp;</td>
        <td>Table to query from.</td>
      </tr>
          <tr>
        <td class="type">string|field&nbsp;&nbsp;</td>
        <td><b>$field</b>&nbsp;&nbsp;</td>
        <td>Field(s) to select. Can either be a string or an array with field name as elements. <br />Example:  <ol><li><div class="src-line">&nbsp;<span class="src-str">&quot;column1,&nbsp;column2&quot;&nbsp;</span><span class="src-comm">//&nbsp;OR</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">&quot;column1&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;column2&quot;</span><span class="src-sym">)</span></div></li>
</ol></td>
      </tr>
          <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$where</b>&nbsp;&nbsp;</td>
        <td>WHERE clause of query.</td>
      </tr>
          <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$order</b>&nbsp;&nbsp;</td>
        <td>ORDER BY clause of query.</td>
      </tr>
          <tr>
        <td class="type">int&nbsp;&nbsp;</td>
        <td><b>$offset</b>&nbsp;&nbsp;</td>
        <td>Offset value of LIMIT clause.</td>
      </tr>
          <tr>
        <td class="type">int&nbsp;&nbsp;</td>
        <td><b>$rowCount</b>&nbsp;&nbsp;</td>
        <td>Number of rows to select.</td>
      </tr>
        </table>
    </div><br />
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
  <hr />
	<a name="methodprintQueryResultTable"></a>
	<h3>method printQueryResultTable <span class="smalllinenumber">[line 225]</span></h3>
	<div class="function">
    <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
    <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
		<code>void printQueryResultTable(
string
$result)</code>
    </td></tr></table>
    </td></tr></table><br />
	
		Print the SQL result in a table.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>deprecated:</b>&nbsp;&nbsp;</td><td>Should only be used temperately in development.</td>
  </tr>
  <tr>
    <td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
  </tr>
</table>
</div>
<br /><br />

	
        <h4>Parameters:</h4>
    <div class="tags">
    <table border="0" cellspacing="0" cellpadding="0">
          <tr>
        <td class="type">string&nbsp;&nbsp;</td>
        <td><b>$result</b>&nbsp;&nbsp;</td>
        <td><a href="http://www.php.net/manual/en/class.mysqli-result.php">MySQLi_Result</a> object holding the result set.</td>
      </tr>
        </table>
    </div><br />
        <div class="top">[ <a href="#top">Top</a> ]</div>
  </div>
</div><br />


        <div class="credit">
		    <hr />
		    Documentation generated on Sat, 26 Feb 2011 10:44:12 +0000 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>